﻿
/**
 * 
 * @module MARSROVERS
 */
var MARSROVERS = MARSROVERS || {};

/**
* Public function, creates a new namespace
* @param {String} ns_string  new namespace name 
* @return {Object} new namespace object 
*/
MARSROVERS.namespace = function (nsstring) {
    var parts = nsstring.split('.'),
    parent = MARSROVERS,
    i;
    // strip redundant leading global
    if (parts[0] === "MARSROVERS") {
        parts = parts.slice(1);
    }
    for (i = 0; i < parts.length; i += 1) {
        // create a property if it doesn't exist
        if (typeof parent[parts[i]] === "undefined") {
            parent[parts[i]] = {};
        }
        parent = parent[parts[i]];
    }
    return parent;
};


MARSROVERS.namespace("MARSROVERS.COMMON");

/**
 * 
 * @module COMMON
 * Provides variables use by most of the modules
 */
MARSROVERS.COMMON = (function ($) {
    return {
        Orientations: {
            North: "N",
            East: "E",
            West: "W",
            South: "S"
        },
        Movements: {
            Left: "L",
            Right: "R",
            Forward: "M"
        }
    };
}(jQuery));